package com.nd.rj.common.login.commonInterfaceImpl;

import com.nd.rj.common.login.NdLoginplatform;
import com.nd.rj.common.login.atomoperation.OperUserInfo;
import com.product.android.business.ApplicationVariable;
import com.product.android.business.bean.UserInfo;
import com.product.android.commonInterface.BaseCommonStruct;
import com.product.android.commonInterface.CIConst;
import com.product.android.commonInterface.ICommonInterObserver;

public class NDCommonInterImpl implements ICommonInterObserver {

	@Override
	public int onCommonInterModelProc(int id, BaseCommonStruct msg) {
		int ret = 0;
		switch(id){
		    //保存用户信息
			case CIConst.NDCOMMON_SAVE_USERINFO_40001:
				if(msg.obj1 != null && msg.obj1 instanceof UserInfo){
					UserInfo userInfo = (UserInfo)msg.obj1;
					if(0 == OperUserInfo.getInstance().SetUserInfo(userInfo)){
						ret = CIConst.COM_RET_OK;
					}else{
						ret = CIConst.COM_RET_ERROR;
					}
				}else{
					ret = CIConst.COM_RET_PARA_ERROR;
				}
				
				break;
			//获取最后一个登陆用户
		case CIConst.NDCOMMON_GET_LAST_LOGIN_USER_40002:
			msg.obj2 = NdLoginplatform.getInstance(msg.iPara).getLastUserInfo(
					ApplicationVariable.INSTANCE.applicationContext);
			ret = CIConst.COM_RET_OK;
			break;
			default:
				ret = CIConst.COM_RET_NO_ID_DIFINE;
				break;
		}
		return ret; 
	}
}
